A good answer might be:

Yes.

Tape Store Example

Programming in Java consists mostly of creating class hierarchies and instantiating objects from them. The Java Development Kit gives you a rich collection of base classes that you can extend to do your work.

Here is a program that uses a class VideoTape to represent tapes available at a video tape rental store. Inheritance is not explicitly used in this program (so far).

class VideoTape
{
  String  title;    // name of the item
  int     length;   // number of minutes
  boolean avail;    // is the tape in the store?

  // constructor
  public VideoTape( String ttl )
  {
    title = ttl; length = 90; avail = true; 
  }

  // constructor
  public VideoTape( String ttl, int lngth )
  {
    title = ttl; length = lngth; avail = true; 
  }

  public void show()
  {
    System.out.println( title + ", " + length + " min. available:" + avail );
  }
  
}

class TapeStore
{
  public static void main ( String args[] )
  {
    VideoTape item1 = new VideoTape("Jaws", 120 );
    VideoTape item2 = new VideoTape("Star Wars" );

    item1.show();
    item2.show();
  }
}

You can copy this program to an editor, save it, and run it.

QUESTION 9:

What will this program print?